#!/usr/bin/python

import pandas as pd
import numpy as np
import os
#import commands
import subprocess
#import pyslha2
import sys
import math
import random



def rang(start, stop, step):
  x = start
  while True:
    if x >= stop: return
    yield x
    x += step

for iN in rang(1.0, 20000, 1.0):
####### input parameter 1000000 ############################################################################
    mH=125.0
    typ=4
    mA=random.uniform(0, 1)*(105.0-70.0)+70.0
    mh=random.uniform(0, 1)*(120.0-100.0)+100.0
    mC=random.uniform(0, 1)*(185.0-95.0)+95.0
    sba=0.0
    tanb=random.uniform(0, 1)*(200-120)+120
    m12_2= mC**2*tanb/(1.0+tanb*tanb)
    l6= 0.0
    l7= 0.0
    data_file="data_input.dat"
#######  run 2HDMC & HiggsBounds & HiggsSignals ####################################################
#######  run 2HDMC & HiggsBounds & HiggsSignals ####################################################
    os.chdir('/home/yancywww/Software/bin/HiggsRelated/2HDMC')
    subprocess.call(['./charged',      str(mh), str(mH), str(mA), str(mC), str(sba), str(tanb), str(l6), str(l7), str(m12_2), str(typ), str(data_file)])
    data = pd.read_csv("data_input.dat",sep="\s+",header=None)
    subprocess.call(['rm', str(data_file)])
    os.chdir('/home/yancywww/Software/bin/HiggsRelated/2HDMC/scan')
######  test vs experimental and theoretical constraints  data[7] <1.0) & 
#    data_theo =  data[(data[11]==1.0)  & (data[12]==1.0) & (data[13]==1.0)]
#    data.to_csv("scan.dat",index=False,header=False,sep=" ",mode="a") 
    data_theo_HB =  data[(data[11]==1.0)  & (data[12]==1.0) & (data[13]==1.0) & (data[7] <1.0)]
    data_theo_HB.to_csv("scan.dat",index=False,header=False,sep=" ",mode="a")
       

       
    


